﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Digitalmes.Model.IoTManagement;
using Digitalmes.Model;

namespace Digitalmes.ViewModel.IoTManagement.MeterDataRecordVMs
{
    public partial class MeterDataRecordTemplateVM : BaseTemplateVM
    {
        
        [Display(Name = "_Model._MeterDataRecord._Device")]
        public ExcelPropety Device_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.DeviceId);
        [Display(Name = "_Model._MeterDataRecord._Source")]
        public ExcelPropety Source_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.Source);
        [Display(Name = "_Model._MeterDataRecord._CollectStatus")]
        public ExcelPropety CollectStatus_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.CollectStatus);
        [Display(Name = "_Model._MeterDataRecord._IsAbnormal")]
        public ExcelPropety IsAbnormal_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.IsAbnormal);
        [Display(Name = "_Model._MeterDataRecord._AbnormalReason")]
        public ExcelPropety AbnormalReason_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.AbnormalReason);
        [Display(Name = "_Model._MeterDataRecord._CurrentValue")]
        public ExcelPropety CurrentValue_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.CurrentValue);
        [Display(Name = "_Model._MeterDataRecord._Usage")]
        public ExcelPropety Usage_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.Usage);
        [Display(Name = "_Model._MeterDataRecord._Unit")]
        public ExcelPropety Unit_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.Unit);
        [Display(Name = "_Model._MeterDataRecord._ReadingTime")]
        public ExcelPropety ReadingTime_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.ReadingTime, true);
        [Display(Name = "_Model._MeterDataRecord._DataValueType")]
        public ExcelPropety DataValueType_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.DataValueType);
        [Display(Name = "_Model._MeterDataRecord._Parameter")]
        public ExcelPropety Parameter_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.ParameterId);
        [Display(Name = "_Model._MeterDataRecord._ParameterName")]
        public ExcelPropety ParameterName_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.ParameterName);
        [Display(Name = "_Model._MeterDataRecord._IsValid")]
        public ExcelPropety IsValid_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.IsValid);
        [Display(Name = "_Model._MeterDataRecord._TenantCode")]
        public ExcelPropety TenantCode_Excel = ExcelPropety.CreateProperty<MeterDataRecord>(x => x.TenantCode);

	    protected override void InitVM()
        {
            
            Device_Excel.DataType = ColumnDataType.ComboBox;
            Device_Excel.ListItems = DC.Set<MeterDevice>().GetSelectListItems(Wtm, y => y.DeviceCode.ToString());
            Parameter_Excel.DataType = ColumnDataType.ComboBox;
            Parameter_Excel.ListItems = DC.Set<MeterParameter>().GetSelectListItems(Wtm, y => y.Description.ToString());

        }

    }

    public class MeterDataRecordImportVM : BaseImportVM<MeterDataRecordTemplateVM, MeterDataRecord>
    {
            //import

    }

}